function Inint_AJAX() 
{
	try 
	{ 
		return new ActiveXObject("Msxml2.XMLHTTP");  
	} 
	catch(e) 
	{} //IE
	try 
	{ 
		return new ActiveXObject("Microsoft.XMLHTTP"); 
	} 
	catch(e) {} //IE
	try 
	{ 
		return new XMLHttpRequest(); 
	} catch(e) {} //Native Javascript
	alert("XMLHttpRequest not supported");
	return null;
};
		
function changeForm(form_id,val) 
{
	
	var req = Inint_AJAX();
	req.onreadystatechange = function () 
	{ 
		document.getElementById('formLoader').innerHTML="<img src='images/ajax-loader.gif' />";
		if (req.readyState==4)
		{
			if (req.status==200) 
			{
				document.getElementById('formLoader').innerHTML=" ";
				document.getElementById(form_id).innerHTML=req.responseText; 
							//alert(req.responseText);
			} 
		}
	};
	req.open("post", "water_rainfall_dropdown.php?data="+form_id+"&val="+val); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
	req.send(null); 
}


function rainfall(rain,val) 
{
	var first=document.getElementById('first_year').value;
	if(first==0)
	{
		alert("choose year");
		document.getElementById('first_year').focus();
              return false;
	}
         if(val < first)
            {
             alert("Selected year is less");
              return false;
            }
	var second=document.getElementById('first_year').value;
	var req = Inint_AJAX();
	req.onreadystatechange = function () 
	{ 
		document.getElementById('rain_loader').innerHTML="<img src='images/ajax-loader.gif' />";
		if (req.readyState==4)
		{
			if (req.status==200) 
			{
				document.getElementById('rain_loader').innerHTML=" ";
				document.getElementById(rain).innerHTML=req.responseText; 
							//alert(req.responseText);
			} 
		}
	};
	req.open("post", "water_rainfall_dropdown.php?data="+rain+"&val="+val+"&val2="+second); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
	req.send(null); 
}
function convert(con) 
{
	var deg=document.getElementById('lat2').value;
	var mi=document.getElementById('lat22').value;
	var se=document.getElementById('lat23').value;
	
	var Edeg=document.getElementById('lat24').value;
	var Emi=document.getElementById('lat25').value;
	var Ese=document.getElementById('lat26').value;
	
	//alert(deg);
	//alert(mi);
	//alert(se);
	var req = Inint_AJAX();
	req.onreadystatechange = function () 
	{ 
		document.getElementById('convert_loader').innerHTML="<img src='images/ajax-loader.gif' />";
		if (req.readyState==4)
		{
			if (req.status==200) 
			{
				document.getElementById('convert_loader').innerHTML=" ";
				document.getElementById('conVal').innerHTML=req.responseText; 
							//alert(req.responseText);
			} 
		}
	};
	req.open("post", "water_rainfall_dropdown.php?data="+con+"&deg="+deg+"&mi="+mi+"&se="+se+"&Edeg="+Edeg+"&Emi="+Emi+"&Ese="+Ese); 
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
	req.send(null); 
	
}

